<template>
	<view>
		<view class="box">
			<view class="titles">邀请新用户下单或邀请商家注册活动</view>
			<!-- <view class="buttons" @click="onShareAppMessage()">立即邀请</view> -->
			<button class="buttons" open-type="share">立即邀请</button>
		</view>
		<view class="box">
			<view class="titles">我的收益</view>
			<view class="flexbox">
				<view class="bosx">
					<text class="textcolor">{{fundsDTO.virtualCurrencyTotalShow||0}}</text>
					<text class="tdsc">收益总额</text>
				</view>
				<view class="bosx">
					<text class="textcolor">{{fundsDTO.virtualCurrencyAvailable||0}}</text>
					<text class="tdsc">邀请成功</text>
				</view>
			</view>
			<view class="mix" @click="nav('/pages/views/inviterDetail')">邀请明细></view>
		</view>
		<view class="box">
			<view class="titles">排行榜</view>
			<view class="flex j-c a-c" style="background-color: #fff;">
					<image src="../../static/tab/null.png" style="width:400rpx;height:400rpx;margin-top: 40rpx;"
					mode="aspectFill"></image>
		<!-- 		<view class="top">//排行榜样式
					<view class="">
						<view class="tx tx2"></view>
						<view class="pad" style="padding-top:40rpx;padding-bottom:40rpx;background-color: #00ff00;">Top2
						</view>
					</view>
					<view class="">
						<view class="tx"></view>
						<view class="pad" style="padding-bottom:80rpx; background-color: #0071FE;">Top1</view>
					</view>
					<view class="">
						<view class="tx tx3"></view>
						<view class="pad" style="padding-top:20rpx;padding-bottom:40rpx;background-color: #fe9d2e;">Top3
						</view>
					</view>
				</view> -->
			</view>
		</view>
	</view>
</template>
<script>
	export default {
		data() {
			return {
				fundsDTO: {},
				limit: 10,
				page: 1,
				list: []
			};
		},
		onShareAppMessage(res) {
			return {
				title: '',
				path: `/pages/index/index?id=${uni.getStorageSync("user").id || ""}`,
				imageUrl: 'https://bige.cdn.bcebos.com/designs/covers/2009/hAh2Qh6sh280.jpg',
			}
		},

		onShareTimeline(res) {
			return {
				title: '',
				path: `/pages/index/index?id=${uni.getStorageSync("user").id || ""}`,
				imageUrl: '',
			}
		},
		onShow() {
			this.$module.ifToken(res => {
				if (res == 1) {
					this.$module.navigateTo('/pages/banmi/user_login')
				} else if (res == 3) { //用户取消登录

				} else { //已经登录
					this.init();
					this.rankingsList()
				}
			})
		},
		methods: {
			rankingsList() {
				var that = this;
				let data = {
					data
				}
				let requestParams = {
					limit: this.limit,
					page: this.page
				};
				this.$module.sm(requestParams, 1, res => {
					data.data = res
				})
				this.Htpp.post('/mehrb/meplus/funds/page', 'app', {
					datalist: data
				}).then(ret => {
					that.$module.sm(ret, 2, res => {
						this.totalPage = res.totalPage
						if (that.page == 1) {
							this.list = res.list;
						} else {
							if (res.list.length > 0) {
								for (var i = 0; i < res.list.length; i++) {
									that.list.push(res.list[i]);
								}
							}
							if (res.list.length < 10) {
								this.log = "没有数据了"
								return
							}
						}
						setTimeout(() => {
							that.isinit = false;
							that.islog = false;
						}, 100)
					})
				})
			},
			// meplus/funds/page
			init() { //查询用户信息
				const that = this
				this.Htpp.user_info().then(res => {
					this.$module.sm(res, 2, ret => {
						let data = ret
						that.user = data.data.user
						if (data.data.business) {
							that.business = data.data.business
							uni.setStorageSync('business', data.data.business)
						}
						uni.setStorageSync('user', data.data.user)
						uni.setStorageSync('fundsDTO', data.data.fundsDTO)
						that.fundsDTO = data.data.fundsDTO
					})
				})
			},
			nav(url) {
				this.$module.ifToken(res => {
					if (res == 1) {
						this.$module.navigateTo('/pages/banmi/user_login')
					} else if (res == 3) { //用户取消登录

					} else { //已经登录
						this.$module.navigateTo(url)
					}
				})
			}
		}
	}
</script>
<style lang="less">
	.tx {
		height: 0;
		border-bottom: 20rpx solid #0060ce;
		border-left: 30rpx solid transparent;
		border-right: 30rpx solid transparent;
	}

	.tx2 {
		border-bottom: 20rpx solid #00be00;
		border-right: 0rpx solid transparent;
	}

	.tx3 {
		border-bottom: 20rpx solid #b67020;
		border-left: 0rpx solid transparent;
	}

	.top {
		display: flex;
		align-items: flex-end;
		width: 100%;
		margin-top: 100rpx;

		view {
			flex: 1;
		}

		.pad {
			flex: 1;
			padding-top: 40rpx;
			text-align: center;
			font-weight: bold;
			color: #fff;
		}
	}

	.textcolor {
		color: #0071FE;
		font-weight: bold;
	}

	.mix {
		text-align: right;
		color: #0071FE;
		margin-top: 40rpx;
		font-size: 26rpx;
		font-weight: bold;
	}

	.buttons {
		border-radius: 50rpx;
		border: 2px solid #0071FE;
		box-shadow: 10rpx 10rpx 10rpx #dddddd;
		font-size: 30rpx;
		font-weight: bold;
		text-align: center;
		color: #0071FE;
		margin-top:40rpx;
	}

	.bosx {
		display: flex;
		flex-direction: column;
		align-items: center;
		.tdsc{
			font-weight: bold;
			margin-top: 10rpx;
		}
	}

	.box {
		margin: 20rpx 40rpx 0;
		padding: 40rpx;
		background-color: #fff;
		border-radius: 20rpx;

		.titles {
			font-weight: bold;
			text-shadow: 10rpx 10rpx 10rpx #d1d1d1;
		}
	}

	.flexbox {
		display: flex;
		justify-content: space-around;
		margin-top:30rpx;
	}
</style>